package kz.pompei.ifacer.grot.acts;

import java.util.UUID;

public class ChangeIndexAct extends Act {
  private final UUID uuid;
  private final int forwardIndex;
  private final int backIndex;
  
  public ChangeIndexAct(UUID uuid, int forwardIndex, int backIndex) {
    this.uuid = uuid;
    this.forwardIndex = forwardIndex;
    this.backIndex = backIndex;
  }
  
  @Override
  public void apply(GrotStorage storage) throws Exception {
    storage.moveToIndex(uuid, forwardIndex);
  }
  
  @Override
  public void cancel(GrotStorage storage) throws Exception {
    storage.moveToIndex(uuid, backIndex);
  }
  
}
